<jsp:useBean id="sessiondata" class="bibbletex.models.SessionData"
	scope="session" />

<%@ page
	import="bibbletex.models.Collaboration,bibbletex.models.Reference,bibbletex.models.SessionData"
	import="java.util.List,bibbletex.views.CollaborationView, bibbletex.controllers.CollaborationController"
	import="java.util.UUID, bibbletex.views.ReferenceView" %>

<%
	String page_title = new String("Reference attributes");
	String onloadjsfunction=new String("");
	boolean show_title = true;
%>
<%@ include file="/header.jsp"%>

<%
	String id_parameter = request.getParameter("rid");
	Reference r;
	if (id_parameter != null){
		r = sessiondata.collaboration.getAllReferences().get(
				sessiondata.collaboration.getAllReferences().indexOf(
						new Reference(UUID.fromString(id_parameter))));
		sessiondata.reference = r;
	}
	else
		r = sessiondata.reference;
%>
<div class="buttonWrapper">
	<a class="button" href="/collaboration/show.jsp">
		Back to Collaboration
	</a>
</div>
<h2>Reference</h2>

<p>
	Type:
	<%=r.getType()%>
</p>

<%
String[][] textfields={{"label", r.getLabel()},
	  				   {"title", r.getTitle()},
					   {"authors", r.getAuthors()},
					   {"booktitle", r.getBooktitle()},
					   {"editor", r.getEditor()},
					   {"publisher", r.getPublisher()},
					  {"organization", r.getOrganization()},
					  {"school", r.getSchool()},
					  {"journal", r.getJournal()},
					  {"year", r.getYear()},
					  {"volume", r.getVolume()},
					  {"number", r.getNumber()},
					  {"pages", r.getPages()},
					  {"month", r.getMonth()},
					  {"note", r.getNote()},
					  {"series", r.getSeries()},
					  {"address", r.getAddress()},
					  {"edition", r.getEdition()},
					  {"isbn", r.getIsbn()},
					  {"howpublished", r.getHowpublished()}};
	
		for (String[] name : textfields)
			if(ReferenceView.notNull(name[1])){
	%>
		<p>
			<%=name[0].substring(0,1).toUpperCase()+name[0].substring(1)%>:
			<%=name[1]%> 
		</p>
	<% } %>
	

<% if (sessiondata.collaboration_is_editable) { %>
<div class="buttonWrapper">
	<a class="button" href="edit.jsp?rid=<%= r.getId() %>">
		Edit this reference
	</a>
</div>
 <% } %>

<%@ include file="/footer.jsp"%>
